/******************************
指标库
* */
<template>
  <el-dialog
    width="50%"
    title="精准激励指标库"
    :close-on-click-modal="false"
    :visible.sync="visible"
    top="8vh"
    @close="closeDialog()"
  >
    <div class="tabBox">
      <div class="btnBox">
        <div></div>
        <div>
          <el-button type="primary">新增指标库</el-button>
        </div>
      </div>
    </div>
    <el-row>
      <el-table
        style="width: 100%;margin-top:20px"
        :data="dataList"
        border
        stripe
        header-align="center"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="bh" align="center" label="指标类型" width="140"></el-table-column>
        <el-table-column prop="sjbt" align="center" label="指标名称" show-overflow-tooltip></el-table-column>
        <el-table-column prop="realname" align="center" label="指标单位" show-overflow-tooltip></el-table-column>
        <el-table-column prop="realname" align="center" label="计算公式" show-overflow-tooltip></el-table-column>
        <el-table-column prop="realname" align="center" label="指标说明" show-overflow-tooltip></el-table-column>
        <el-table-column prop="realname" align="center" label="指标规则" show-overflow-tooltip></el-table-column>
        <el-table-column prop="realname" align="center" label="指标序号" show-overflow-tooltip></el-table-column>
        <el-table-column fixed="right" align="center" label="操作">
          <template slot-scope="scope">
            <span>
              <el-button @click="copyLibrary(scope.row)" type="primary">复制</el-button>
              <el-button type="primary">编辑</el-button>
              <el-button type="primary">复制</el-button>
              <el-button type="primary">编辑</el-button>
            </span>
          </template>
        </el-table-column>
      </el-table>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" plain @click="handleConfirm">确定</el-button>
      <el-button type="primary" plain @click="closeDialog()">返回</el-button>
    </span>
    <UserCommonSelect v-if="usercomment" ref="usercomment" @submitfy="submitfy"></UserCommonSelect>
  </el-dialog>
</template>

<script>
import UserCommonSelect from "@/views/dailyExamine/components/usercomment-selectCopy-zb"; //人员选择的组件

export default {
  data() {
    return {
      multipleSelection: [],
      dataList: [],
      usercomment: false,
      options: [],
      dialogTitle: "新增",
      visible: false,
      dataForm: {
        ids: []
      }
    };
  },
  components: {
    UserCommonSelect
  },
  created() {},
  methods: {
    copyLibrary(data) {},
    showTarLibrary() {},
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    //   人员展示
    showPerson() {
      this.usercomment = true;
      this.$nextTick(() => {
        this.$refs.usercomment.init({}, "cyr", JSON.stringify({}));
      });
    },
    submitfy(data) {
      this.options = data.tableDataUser;
      this.dataForm.ids = data.tableDataUser.map(it => {
        return it.userId;
      });
    },
    // 确定
    handleConfirm() {
      this.$refs.dataForm.validate(valid => {
        if (valid) {
          this.$emit("closeDialog");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },

    // 初始化
    init(data) {
      this.visible = true;
    },
    // 表单提交
    dataFormSubmit() {},
    // 关闭
    closeDialog() {
      this.visible = false;
      this.$emit("closeDialog");
    }
  }
};
</script>

<style lang="scss">
.tabBox {
  width: 100%;
  .btnBox {
    display: flex;
    justify-content: space-between;
  }
}
</style>